package com.it.day2;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;

/**
 * ClassName: CompletableFutureApiDemo
 * Description: CompletableFuture常用Api测试
 *
 * @Author: csx
 * @Create: 2025/5/8 - 16:00
 * @version: v1.0
 */
public class CompletableFutureApiDemo {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        System.out.println(CompletableFuture.supplyAsync(() -> {
            return 10;
        }).thenCombine(CompletableFuture.supplyAsync(() -> {
            return 20;
        }), (r1, r2) -> r1 + r2).join());

    }
}
